package xidw_router

import (
	"server/apps/xidw/xidw_api"
	"server/middleware"

	"github.com/gin-gonic/gin"
)

type MenuRouter struct{}

func (s *MenuRouter) InitMenuRouter(Router *gin.RouterGroup) (R gin.IRoutes) {
	menuRouter := Router.Group("menu").Use(middleware.OperationRecord())
	menuRouterWithoutRecord := Router.Group("menu")
	authorityMenuApi := xidw_api.AuthorityMenuApi{}
	{
		menuRouter.POST("addBaseMenu", authorityMenuApi.AddBaseMenu)
		menuRouter.POST("addMenuAuthority", authorityMenuApi.AddMenuAuthority)
		menuRouter.POST("deleteBaseMenu", authorityMenuApi.DeleteBaseMenu)
		menuRouter.POST("updateBaseMenu", authorityMenuApi.UpdateBaseMenu)
	}
	{
		menuRouterWithoutRecord.POST("getMenu", authorityMenuApi.GetMenu)
		menuRouterWithoutRecord.POST("getMenuList", authorityMenuApi.GetMenuList)
		menuRouterWithoutRecord.POST("getBaseMenuTree", authorityMenuApi.GetBaseMenuTree)
		menuRouterWithoutRecord.POST("getMenuAuthority", authorityMenuApi.GetMenuAuthority)
		menuRouterWithoutRecord.POST("getBaseMenuById", authorityMenuApi.GetBaseMenuById)
	}
	return menuRouter
}
